import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state:{
    userId:'',
    token:'',
    activeUrl:null,
    activeMenu:'',
    activeTab:'',
    menus:[],
    tabs:[]
  },
  getters:{
    getToken(state){
      return state.token
    },
    getUserId(state){
      return state.userId
    }
  },
  mutations:{
    setToken(state,token){
      state.token = token
    },
    setUserId(state,userId){
      state.userId = userId
    }
  },
  actions:{
    setToken(context,token){
      context.commit('setToken',token)
    },
    setUserId(context,userId){
      context.commit('setUserId',userId)
    }
  }
})

export default store
